package com.emperor.receipt.logic;

import java.util.ArrayList;
import java.util.Date;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

import com.emperor.core.logic.ReportDataSource;

import net.sf.jasperreports.engine.JRDataSource;

/**
 * Although this class is a dummy, do not delete it as it is needed by the iReport 
 * for the dummy data used in the report of Receipt-Print.jrxml.
 * @author tatseng.ho
 *
 */
public class ReceiptDSFactory {
	
	static List list = new ArrayList();
	
	public static JRDataSource createDatasource() {
		
		if (list.isEmpty()) {
			Map sample = new HashMap();
			sample.put(Receipt.FLD_ID, new Long(999));
			sample.put(Receipt.FLD_CODE, "R299999");
			sample.put("cust_id", new Long(1));
			sample.put(Receipt.FLD_PAYMETHOD, "pay.cash");
			sample.put(Receipt.FLD_TOTAL, new Double(1999.99));
			sample.put(Receipt.FLD_PAID, new Double(2000.00));
			sample.put(Receipt.FLD_CHANGE, new Double(0.01));
			sample.put(Receipt.FLD_CRTDATE, new Date());
			
			list.add(sample);	
		}
		
		return new ReportDataSource(list);
	}
	
	public static List getList() {
		return list;
	}
	public static void setList(List _list) {
		list = _list;
	}
}
